% P_TRIMMED = POLYTRIMZEROS(P)  Trim leading zeros from a polynomial
%
%   Inputs:
%
%       p       Polynomial to be trimmed
%
%   Outputs:
%
%       p_trimmed  p with leading zeros removed

function p_trimmed = polyTrimZeros(p)

    if polyIsZero(p)
        p_trimmed = -1;
    else
        while length(p) > 1 && p(end) == -1
            p = p(1:end-1);
        end
        p_trimmed = p;
    end
end
